﻿using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore;
using TL_Cloud.Core.Entities;

namespace TL_Cloud.Models.BookShop
{
    public partial class Bk_Recommend : BaseEntity
    {
        public string RecommendId { get; set; }
        public string RecommendUserId { get; set; }
        public string RecommendObject { get; set; }
        public string RecommendObjectId { get; set; }
        public string BookId { get; set; }
 
        public override void Create(string userId, string userName)
        {
            this.RecommendId = Guid.NewGuid().ToString();
            this.CreateDate = DateTime.Now;
        }
        
        public override void Mapping(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Bk_Recommend>(entity =>
            {
                entity.HasKey(e => e.RecommendId);

                entity.ToTable("BK_Recommend");

                entity.Property(e => e.RecommendId)
                    .HasMaxLength(50)
                    .IsUnicode(false)
                    .ValueGeneratedNever();

                entity.Property(e => e.BookId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.RecommendObject)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.RecommendObjectId)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.RecommendUserId)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });
        }
    }
}
